﻿// <copyright file="IEntityReader.cs" company="City of Portland, BES-ASM">
// </copyright>
// <summary>IEntityReader class</summary>

namespace BESASM.EMGAATS.DataAccess
{
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using BESASM.EMGAATS.BusinessClasses;
  using ESRI.ArcGIS.Geodatabase;

  /// <summary>
  /// An interface for entity readers
  /// </summary>
  public interface IEntityReader
  {
    /// <summary>
    /// Gets the entity specified by querying the database.
    /// </summary>
    /// <param name="entityType">The entity type to get.</param>
    /// <param name="id">The entity id.</param>
    /// <returns>A new entity populated with data from the database.</returns>
    IEntity GetEntity(EntityType entityType, int id);

    /// <summary>
    /// Refreshes the properties of the given entity based on the data in the database.
    /// </summary>
    /// <param name="entity">The entity to be refreshed.</param>
    void RefreshEntity(IEntity entity);

    /// <summary>
    /// Returns a value indicating whether the specified entity exists in the database.
    /// </summary>
    /// <param name="entityType">The entity type to check.</param>
    /// <param name="id">The entity id.</param>
    /// <returns>A value indicating whether the specified entity exists in the database.</returns>
    bool EntityExists(EntityType entityType, int id);

    /// <summary>
    /// Returns a value indicating whether a corresponding record exists for the given entity.
    /// </summary>
    /// <param name="entity">The entity to check.</param>
    /// <returns>A value indicating whether a corresponding record exists for the given entity.</returns>
    bool EntityExists(IEntity entity);
  }
}
